import axios from "axios"
import adsUrls from "../../../urls/corporate/ads/ads"

export default {
  // 获取所有广告
  fetchGetAdsByPage (params) {
    return axios.post(adsUrls.getAdsByPage, params)
  },
  // 上传图片
  fetchUploadImage (imageData) {
    return axios.post(adsUrls.uploadImage, imageData, { headers: { "Content-Type": "multipart/form-data" } })
  },
  // 校验广告名称是否唯一
  fetchCheckAds (adcompany) {
    return axios.post(adsUrls.checkAds + "?adcompany=" + adcompany)
  },
  // 添加新的广告
  fetchAddAds (params) {
    return axios.post(adsUrls.addAds, params)
  },
  // 删除广告
  fetchDeleteAds (adid) {
    return axios.post(adsUrls.deleteAds + "?adid=" + adid)
  },
  // 批量删除广告
  fetchBatchDeleteAds (params) {
    return axios.post(adsUrls.batchDeleteAds, params)
  }
}
